package com.ddogring.business.domain;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @BelongsProject: eshop
 * @BelongsPackage: com.ddogring.business.domain
 * @Author: DdogRing
 * @CreateTime: 2023-01-30  10:46
 * @Description: TODO
 * @Version: 1.0
 */
@Data
@TableName("t_commodity")
public class Commodity {

    /** 主键 */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /** 餐品名称 */
    @NotBlank(message = "餐品名称不能为空")
    private String commodity;

    /** 用户id */
    @NotNull(message = "用户id不能为空")
    private Integer userId;

    /** 餐品描述 */
    @NotBlank(message = "餐品描述不能为空")
    private String description;

    /** 餐品价格 */
    @NotNull(message = "餐品价格不能为空")
    private BigDecimal price;

    /** 图片路径 */
    private String picture;

    /** 1待发布 2已发布 3已下架 */
    private Integer status;

    /** 0未删除 1已删除 */
    @TableLogic(value = "0", delval = "1")
    @TableField(fill = FieldFill.INSERT)
    private Integer delFlag;

    /** 创建时间 */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新时间 */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 是否包邮 0是1否 */
    private Integer isMail;

    /** 包邮价格 */
    private BigDecimal mailPrice;

    /** 总数 */
    private Integer total;

    /** 剩余数量 */
    private Integer remainder;

    @TableField(exist = false)
    private BigDecimal bPrice;

    @TableField(exist = false)
    private BigDecimal ePrice;

    @TableField(exist = false)
    private List<JSONObject> info;

    @TableField(exist = false)
    private Remarks remarks;

    @TableField(exist = false)
    private Integer pageNum;

    @TableField(exist = false)
    private Integer pageSize;

    @TableField(exist = false)
    private Integer addNumber;

    public Integer pageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer pageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
